package org.hitchhike.core.service;

import java.util.List;

import org.hitchhike.core.domain.Cities;
import org.hitchhike.core.repository.CitiesRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

@Service
@CacheConfig(cacheNames = "cities")
public class CitiesService {

  @Autowired
  private CitiesRepository citiesRepository;

  @Cacheable
  public List<Cities> findByProvinceId(String provinceid) {
    return citiesRepository.findByProvinceid(provinceid);
  }

  @Cacheable
  public Cities findByCityid(String cityid) {
    return citiesRepository.findByCityid(cityid);
  }

}
